package persistency;

/**
 * Repository.java
 * Purpose: A generic storage facility for model objects.
 * Methods added here should be applicable to all model objects.
 * 
 * @author Hans Brems
 * @version 0.1 31/05/2012
 */

import java.util.List;

public interface Repository<T> {
	
	public static final String PERSISTENCE_UNIT_NAME = "MiniServiceDesk";
	
	/** Inserts a new entity into the database */
	public void insert(T entity) throws PersistencyException;
	
	/** Updates an existing entity */
	public void update (T entity) throws PersistencyException;
	
	/** Deletes an existing entity (sets inactive) */
	public void delete (T entity) throws PersistencyException;
	
	/** Retrieves all entities from the database */	
	public List<T> getAll() throws PersistencyException;
	
	/** Retrieves an entity by id */ 
	public T getById(Object id) throws PersistencyException;
	
	/** Returns a count of records in the database */
	public int getCount() throws PersistencyException;
}
